package com.hellobike.haxing.modules.product.entity;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hellobike.haxing.modules.product.mapper.typehandler.JSONArrayHandler;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @Description: 售卖商品
 * @Author: haxing-boot
 * @Date: 2020-01-17
 * @Version: V1.0
 */
@Data
@TableName(value = "t_product", autoResultMap = true)
public class Product implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * id与spu id保持一致
     */
    @TableId(type = IdType.INPUT)
    private Long id;
    /**
     * （冗余）类型：1-生鲜 2-日杂
     */
    @Excel(name = "（冗余）类型：1-生鲜 2-日杂", width = 15)
    private Integer type;
    /**
     * （冗余）SPU编码
     */
    @Excel(name = "（冗余）SPU编码", width = 15)
    private String spuCode;
    /**
     * 商品标题
     */
    @Excel(name = "商品标题", width = 15)
    private String title;
    /**
     * 副标题
     */
    @Excel(name = "副标题", width = 15)
    private String subTitle;
    /**
     * 主图
     */
    @Excel(name = "主图", width = 15)
    private String mainImage;
    /**
     * 轮播图
     */
    @Excel(name = "轮播图", width = 15)
    @TableField(typeHandler = JSONArrayHandler.class)
    private JSONArray headImages;
    /**
     * 详情图
     */
    @Excel(name = "详情图", width = 15)
    @TableField(typeHandler = JSONArrayHandler.class)
    private JSONArray contentImages;
    /**
     * （冗余）一级分类id
     */
    @Excel(name = "（冗余）一级分类id", width = 15)
    private Long categoryId1;
    /**
     * （冗余）二级分类id
     */
    @Excel(name = "（冗余）二级分类id", width = 15)
    private Long categoryId2;
    /**
     * （冗余）三级分类id
     */
    @Excel(name = "（冗余）三级分类id", width = 15)
    private Long categoryId3;
    /**
     * 上下架状态：0-下架 1-上架
     */
    @Excel(name = "上下架状态：0-下架 1-上架", width = 15)
    private Integer onlineStatus;
    /**
     * （冗余）规格属性
     */
    @Excel(name = "（冗余）规格属性", width = 15)
    @TableField(typeHandler = JSONArrayHandler.class)
    private JSONArray dimensions;
    /**
     * 售后模板id
     */
    @Excel(name = "售后模板id", width = 15)
    private Long afterSaleTemplateId;
    /**
     * 规格说明
     */
    @Excel(name = "规格说明", width = 15)
    @TableField(typeHandler = JSONArrayHandler.class)
    private JSONArray specifications;
    /**
     * 营销标签
     */
    @Excel(name = "营销标签", width = 15)
    @TableField(typeHandler = JSONArrayHandler.class)
    private JSONArray marketingTags;
    /**
     * 人工设置销量
     */
    @Excel(name = "人工设置销量", width = 15)
    private Integer manualSalesVolume;
    /**
     * 实际销量
     */
    @Excel(name = "实际销量", width = 15)
    private Integer actualSalesVolume;
    /**
     * 可售类型：0-全部站点、1-指定站点
     */
    @Excel(name = "可售类型：0-全部站点、1-指定站点", width = 15)
    private Integer availableType;
    /**
     * 指定可售站点id集合
     */
    @Excel(name = "指定可售站点id集合", width = 15)
    @TableField(typeHandler = JSONArrayHandler.class)
    private JSONArray availableShops;
    /**
     * 创建时间
     */
    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /**
     * 更新时间
     */
    @Excel(name = "更新时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    /**
     * 创建人
     */
    @Excel(name = "创建人", width = 15)
    private Integer createBy;
    /**
     * 修改人
     */
    @Excel(name = "修改人", width = 15)
    private Integer updateBy;
    /**
     * 是否删除：0-否 1-是
     */
    @Excel(name = "是否删除：0-否 1-是", width = 15)
    @TableLogic
    private Integer deleted;


    /**
     * 一级分类名称
     */
    @TableField(exist = false)
    private String categoryName1;
    /**
     * 二级分类名称
     */
    @TableField(exist = false)
    private String categoryName2;
    /**
     * 三级分类名称
     */
    @TableField(exist = false)
    private String categoryName3;

    /**
     * SKU列表
     */
    @TableField(exist = false)
    private List<Sku> skus;
    /**
     * SPU ID
     */
    @TableField(exist = false)
    private Long spuId;
}
